#ifdef a
//比较大小并求和
#include<stdio.h>
int main() {
	int num1, num2, num3, num4;
	scanf("%d,%d,%d,%d", &num1, &num2, &num3, &num4);
	int min = num1 > num2 ? num2 : num1;
	int max = num3 > num4 ? num3 : num4;
	printf("%d", min + max);
	return 0;
}
#endif 
